import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
    state: {
        tabbarShow:true,
        titlebarShow:true,
        direction: 'forward',
        isLoading: false,
        tabberItemShow:"0",
        tabItem:"0"
    },
    mutations: {
        updateTitlebarShow(state, payload){
            state.titlebarShow = payload
        },
        updateTabItem(state, tabItem){
            state.tabItem = tabItem
        },
        updateTabbarShow(state, payload){
            state.tabbarShow = payload
        },
        updateTabbarItemShow(state, tabberItemShow){
            state.tabberItemShow = tabberItemShow
        },
        UPDATE_LOADING (state, status) {
            state.isLoading = status
        },
        UPDATE_DIRECTION (state, direction) {
            state.direction = direction
        }
        
        
    },
    getters:{
        getTitleBarShow(state){
            return state.titlebarShow
        },

        getTabbarShow(state){
            return state.tabbarShow
        },

        getDirection(state){
            return state.direction
        },

        isLoading(state){
            return state.isLoading
        },
    },
    actions: {
        updateTabbarShow({ commit },payload){
            commit('updateTabbarShow', payload)
        },
        updateTitlebarShow(state, payload){
            commit('updateTitlebarShow', payload)
        },
    }
})
